/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package server.teste;

import server.domain.Client;
import server.service.ClientService;

/**
 *
 * @author fillipe
 */
public class ClientTest {

    public static void main(String[] args) {
        insertClient();
        selectClient();
        updateClient();
        deletClient();
    }

    private static void insertClient() {
        Client client = new Client("Fillipe Abraão", "55555555");
        ClientService service = new ClientService();
        System.out.println(service.insert(client));        
    }
    
    private static void selectClient(){
        ClientService service = new ClientService();
        System.out.println("\n" + service.getById(3L) + "\n");
        System.out.println("\n" + service.getByCPF("123456789"));
        System.out.println("\n" + service.getByName("Fillipe"));
    }

    private static void updateClient() {
        ClientService service = new ClientService();
        Client client = service.getById(1L);
        client.setCpf("121212");
        client.setName("Selmini Maluco");
        System.out.println("\n" + service.update(client));
    }

    private static void deletClient() {
        ClientService service = new ClientService();
        //Client client = service.getById(3);
        System.out.println("\n" + service.delete(new Client(3l)));
        System.out.println("\n" + service.delete(new Client(3l)));
        System.out.println("\n" + service.delete(new Client(3l)));
        System.out.println("\n" + service.delete(new Client(3l)));
    }
}
